package com.xiaomei.manager.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xiaomei.manager.dao.ActivtiyReleaseMapper;
import com.xiaomei.manager.model.ActivtiyRelease;
import com.xiaomei.manager.model.Experience;
import com.xiaomei.manager.service.IActivtiyReleaseService;
import com.xiaomei.manager.web.dto.req.ActivtiyQueryDto;
import com.xiaomei.manager.web.page.Page;
@Service
public class ActivtiyReleaseServiceImpl implements IActivtiyReleaseService {
	
	@Autowired
	private ActivtiyReleaseMapper activtiyReleaseMapper;
	
	/**
	 * 根据param返回活动发布信息
	 */
	@Override
	public List<ActivtiyRelease> getActivtiyForList(ActivtiyQueryDto paramDto,
			Page<ActivtiyRelease> page) {
		// TODO Auto-generated method stub
		page.setParamDto(paramDto);
		return activtiyReleaseMapper.selectByParamMap(page);
	}

	@Override
	public Integer selectMaxID() {
		// TODO Auto-generated method stub
		return activtiyReleaseMapper.selectMaxId();
	}

	@Override
	public boolean createActivtiyRelease(ActivtiyRelease activtiy) {
		// TODO Auto-generated method stub
		return activtiyReleaseMapper.insert(activtiy)==1 ? true : false;
	}

	@Override
	public boolean updateActivtiyRelease(ActivtiyRelease activtiy) {
		// TODO Auto-generated method stub		
		return activtiyReleaseMapper.updateByPrimaryKeySelective(activtiy)==1 ? true : false;
	}

	@Override
	public ActivtiyRelease findOne(Integer id) {
		// TODO Auto-generated method stub
		return activtiyReleaseMapper.selectByPrimaryKey(id) ;
	}

	@Override
	public ActivtiyRelease selectActivtiyReleaseById(Integer id) {
		// TODO Auto-generated method stub
		return activtiyReleaseMapper.selectByPrimaryKey(id);
	}

	@Override
	public boolean deleteActivtiyRelease(Integer id) {
		// TODO Auto-generated method stub
		return activtiyReleaseMapper.deleteByPrimaryKey(id)==1 ? true : false ;
	}

}
